<template>
  <div class="rent-page">
    <van-sticky>
      <van-nav-bar class="page-nav-bar" title="房屋管理" left-arrow @click-left="onClickLeft" />
    </van-sticky>
    <van-empty image="search" description="您还没有房源，去发布房源吧~" v-if="isShow" />
    <Loading v-if="isShow"></Loading>
    <HouseList :roomList="roomList"></HouseList>
  </div>
</template>

<script>
import HouseList from '@/components/houseList.vue'
import { getRentApi } from '@/api/my'
import Loading from '@/components/loading.vue'
export default {
  props: {},
  data() {
    return {
      roomList: [],
      isShow: true,
    }
  },
  computed: {},
  created() {
    this.getHouseList()
  },
  mounted() {},
  watch: {},
  methods: {
    onClickLeft() {
      this.$router.push('/layout/my')
    },
    async getHouseList() {
      try {
        const res = await getRentApi()
        this.roomList = res.body
      } finally {
        this.isShow = false
      }
    },
  },
  components: {
    HouseList,
    Loading,
  },
}
</script>

<style scoped lang="less">
.rent-page {
  .page-nav-bar {
    background-color: #21b97a;
    //  font-size: 18px;
    //  height:45px
  }
}
</style>
